package com.example.mapper;


import com.example.entity.orders.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * 操作orders相关数据接口
 */
@Mapper
public interface OrdersMapper {

    /**
     * 新增
     */
    int insert(Orders orders);

    /**
     * 删除
     */
    int deleteById(Integer id);

    /**
     * 修改
     */
    int updateById(Orders orders);

    /**
     * 根据ID查询
     */
    Orders selectById(Integer id);

    /**
     * 查询所有
     */
    List<Orders> selectAll(Orders orders);



    List<Orders> selectSellerOrder(Orders orders);
//    List<Orders> associateSelectBySellerId();

    Orders selectByOrderNumber(String orderNumber);
    @Select("select * from orders where order_date like concat( #{date}, '%') and buyer_id = #{buyerId}")
    List<Orders> selectByDate(Integer buyerId, String date);

    List<Orders> findOrdersByDateRange(Date startDate, Date endDate);

    // 近七天订单销量
    // 近七天退货量

}